<template>
  <header>
    <i
      class='iconfont icon-fanhui'
      @click="goBack"
    ></i>
    <!--  @click="$router.back()" -->
    <slot>
      <!-- 了解插槽的作用 -->
      <span>我的地址</span>
    </slot>
    <i class="iconfont">&#xe6b1;</i>
  </header>
</template>

<!--
<script>
不需要
</script>
-->

<script>
export default {
  methods: {
    goBack() {
      //console.log(this.$route);
      //this.$route.path == "/path");
      //路由跳转策略
      //注意 route 和 router
      if (this.$route.name == "path-list") {
        this.$router.replace("/path"); //关闭
        //this.$router.push("/path"); //关闭
      } else {
        this.$router.push("/my");
      }
    },
  },
};
</script>


<style scoped lang="scss">
header {
  display: flex;
  justify-content: space-between;
  width: 100vw;
  align-items: center;
  line-height: 1.1733rem;
  /*height: 100%; /* 这里就算是100%也不起效   */
  height: 1.1733rem;
  background-color: #b0352f;
  color: whitesmoke;
  /*   div {
    width: 100%; //为什么这里的div调不了大小？
  } */
  i {
    padding: 0 0.4rem;
    font-size: 0.586666rem;
  }
  span {
    font-weight: 500;
    font-size: 0.6133rem;
  }
}
</style>